#include "Quaternion.h"
#include "Matrix.h"

Quaternion::Quaternion(void) : 
D3DXQUATERNION( 0.f, 0.f, 0.f, 0.f )
{
}

Quaternion::Quaternion( const float x, const float y, const float z, const float w ) : 
D3DXQUATERNION( x, y, z, w )
{
}

Quaternion::~Quaternion(void)
{
}

void Quaternion::Normalize()
{
	D3DXQuaternionNormalize( this, this );
}

void Quaternion::PreMultiply( const Quaternion & quat )
{
	D3DXQuaternionMultiply( this, this, &quat );
}

void Quaternion::PostMultiply( const Quaternion & quat )
{
	D3DXQuaternionMultiply( this, &quat, this );
}

float Quaternion::GetYaw()
{
	Matrix mat(*this);
	return mat.GetYaw();
}

float Quaternion::GetPitch()
{
	Matrix mat(*this);
	return mat.GetPitch();
}

float Quaternion::GetRoll()
{
	Matrix mat(*this);
	return mat.GetRoll();
}

Quaternion Quaternion::Slerp( const Quaternion & start, const Quaternion & end, const float t )
{
	Quaternion quat;

	D3DXQuaternionSlerp( &quat, &start, &end, t );

	return quat;
}
